var subsets = function(arr) {
    let rsl = [
        []
    ]
    for (let i = 0; i < arr.length; i++) {
        const item = arr[i];
        let len = rsl.length
        for (let j = 0; j < len; j++) {
            let rslItem = rsl[j].map((item, index) => {
                return item
            })
            rslItem.push(item)
            rsl.push(rslItem)
        }
    }
    return rsl
};
console.log(subsets([1, 2, 3]))